<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("actnlist.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Route_Expense_Delete2 extends Page
{
       public $hiddenRoute = null;
       public $hiddenEmp = null;
       public $hiddenExpense = null;
       function Route_Expense_Delete2Create($sender, $params)
       {
       $emp = $_GET['emp'];
       $route = $_GET['route'];
       $expense = $_GET['expense'];
       $this->hiddenEmp->setValue($emp);
       $this->hiddenRoute->setValue($route);
       $this->hiddenExpense->setValue($expense);

       $result = mysql_query("DELETE FROM rou_expense_tbl WHERE route_id='".$this->hiddenRoute->getValue()."' AND expense_id='".$this->hiddenExpense->getValue()."'") or die ('DELETE JOB - ' . mysql_error());
       $result_veh_exp = mysql_query("DELETE FROM veh_expense_tbl WHERE route_payment_id='".$this->hiddenExpense->getValue()."'") or die ('DELETE VEH EXP - ' . mysql_error());
       //die($result_veh_exp);
       redirect('route_expense_list2.php?emp='.$this->hiddenEmp->getValue().'&route='.$this->hiddenRoute->getValue());
       }


}

global $application;

global $Route_Expense_Delete2;

//Creates the form
$Route_Expense_Delete2=new Route_Expense_Delete2($application);

//Read from resource file
$Route_Expense_Delete2->loadResource(__FILE__);

//Shows the form
$Route_Expense_Delete2->show();

?>